﻿<Window x:Class="Pilhas.Stacks"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Pilha" Height="600" Width="950" SizeChanged="grid_SizeChanged" Background="Black"
        ResizeMode="CanMinimize" MinHeight="600" MinWidth="950" >
    
    <Window.Resources>
        <ResourceDictionary>
    
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/CommomFunctions;component/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            
            <Style TargetType="{x:Type Ellipse}">
                <Setter Property = "BitmapEffect" >
                    <Setter.Value>
                        <OuterGlowBitmapEffect GlowColor="#FF6BEF28"/>
                    </Setter.Value>
                </Setter>
            </Style>
            
            <Style TargetType="{x:Type Button}">
                <Setter Property = "Height" Value="28" />
                <Setter Property = "Grid.Row" Value="2" />
                <Setter Property = "Grid.Column" Value="3" />
                <Setter Property = "Grid.ColumnSpan" Value="2" />
                <Setter Property = "Visibility" Value="Visible" />
                <Setter Property = "VerticalAlignment" Value="Top" />                    
            </Style>
            
        </ResourceDictionary>
    </Window.Resources>

    <Grid Name="myGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ShowGridLines="False" Margin="0" ClipToBounds="True" Background="Black">
        
        <Grid.RowDefinitions>
            <RowDefinition Height="50*" />
            <RowDefinition Height="55*" />
            <RowDefinition Height="250*" />
            <RowDefinition Height="10*" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="40*" />
            <ColumnDefinition Width="40*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="50*" />
            <ColumnDefinition Width="40*" />
            <ColumnDefinition Width="90*" />
        </Grid.ColumnDefinitions>

        <Button Name="btnCreate" Margin="25,115,90,0" IsEnabled="True" Click="btnCreate_Click" HorizontalAlignment="Left" MinWidth="90">Criar Pilha</Button>
        <Button Name="btnDestroy" Margin="25,155,90,0"  IsEnabled="False" Click="btnDestroy_Click" HorizontalAlignment="Left" MinWidth="90">Destruir Pilha</Button>
        <Button Name="btnPush" Margin="120,115,30,0"  IsEnabled="False" Click="btnPush_Click" HorizontalAlignment="Stretch" MaxWidth="90">Empilhar</Button>
        <Button Name="btnPop" Margin="120,155,30,0" IsEnabled="False" Click="btnPop_Click" HorizontalAlignment="Stretch" MaxWidth="90">Desempilhar</Button>

        <Menu Grid.Row="0" Margin="0" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.ColumnSpan="2">
            <MenuItem Header="_Opções">
                <MenuItem Name="useLetters" Click="useLetters_Click" Header="Informar Rótulos"/>
            </MenuItem>

            <MenuItem Header="_Ajuda">
                <MenuItem Name="help" Click="help_Click"  Header="Ajuda Estrutura de Dados"/>
                <MenuItem Name="tutorial" Click="tutorial_Click" Header="Tutorial"/>
                <MenuItem Name="about" Click="about_Click" Header="Sobre"/>
            </MenuItem>
        </Menu>

        <Rectangle Name="stackBorder"  Stretch="Fill"  Margin="100, 0, 50.0, 0"  Visibility="Hidden"
                   Grid.Column="0" Grid.Row="2" Grid.RowSpan="1" Grid.ColumnSpan="3" 
                   VerticalAlignment="Stretch" HorizontalAlignment="Stretch" 
                   StrokeThickness="3" Fill="Black" Stroke="#FF24F209" RadiusX="15" RadiusY="15" />
        
        <RichTextBox Name="txtCode" Margin="75,10,15,15" Grid.Column="3" Grid.ColumnSpan="4" Grid.Row="2" Grid.RowSpan="2" Height="230" VerticalAlignment="Bottom" MaxWidth="330"
                 AcceptsTab="True" AcceptsReturn="True" VerticalScrollBarVisibility="Auto" HorizontalAlignment="Right" IsReadOnly="True" Background="Black" >

            <FlowDocument>
                <Paragraph FontFamily="comic sans" Foreground="AntiqueWhite" FontSize="19">Operações Básicas com Pilhas em C#</Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Cria nova pilha
                    <LineBreak/>
                    <Run Foreground="SkyBlue">Stack</Run>
                    <Run Foreground="LightGray" FontWeight="ExtraLight">minhaPilha =</Run>
                    <Run Foreground="Blue">new</Run>
                    <Run Foreground="SkyBlue">Stack</Run>
                    <Run Foreground="LightGray">( );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Insere o elemento no topo da pilha (PUSH)
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaPilha.Push( elemento );</Run>
                </Paragraph>

                <Paragraph Foreground="LawnGreen" FontSize="15">// Remove o elemento do topo da pilha (POP)
                    <LineBreak/>
                    <Run Foreground="LightGray">minhaPilha.Pop( );</Run>
                </Paragraph>
            </FlowDocument>
            
        </RichTextBox>
        
    </Grid>
</Window>

